package com.ruoyi.common.customize.util.chat;

import com.ruoyi.common.customize.constants.AIConstants;

/**
 * AI聊天相关工具类
 *
 * @author gdk
 * @since 2023/5/16 20:10
 */
public class AIChatUtils {
    /**
     * 从提问中截取前n个字符作为标题
     *
     * @param prompt 提示词
     * @return {@link String }
     * @author gdk
     * @since 2023/5/16 20:11
     */
    public static String getChatTitle(String prompt) {
        int endIndex = Math.min(prompt.length(), AIConstants.CHAT_TITLE_MAX_LENGTH);
        return prompt.substring(0, endIndex);
    }
}
